<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/css/oksub.css">
    <script type="text/javascript" src="/static/lib/loading/okLoading.js"></script>
    <script src="/static/lib/layui/layui.js"></script>
</head>
<body>
<form class="layui-form" action="" style="padding: 20px">
    <div class="layui-form-item">
        <label class="layui-form-label">商品名称</label>
        <div class="layui-input-block">
            <input type="text" name="title" required lay-verify="required|title" placeholder="请输入商品名称"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品简述</label>
        <div class="layui-input-block">
            <input type="text" name="simple_desc" required lay-verify="required|simple_desc" placeholder="请输入商品简述"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品型号</label>
        <div class="layui-input-block">
            <input type="text" name="model" required lay-verify="required|model" placeholder="请输入商品型号"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    {include file="common/select" field="$data" /}
    <div class="layui-form-item">
        <label class="layui-form-label">商品品牌</label>
        <div class="layui-input-block">
            <select name="city" lay-verify="required" required lay-verify="required|brand_id" >
                <option value="">商品品牌</option>
                {foreach $brand as $key=>$vo }
                <option value="{$vo.id}">{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">产地位置</label>
        <div class="layui-input-block">
            <input type="text" name="place_origin" required lay-verify="required|place_origin" placeholder="请输入产地位置"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">库存单位</label>
        <div class="layui-input-block">
            <input type="text" name="inventory_unit" required lay-verify="required|inventory_unit" placeholder="请输入库存单位"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">最低起购</label>
        <div class="layui-input-block">
            <input type="text" name="buy_min_number" required lay-verify="required|buy_min_number" placeholder="请输入最低起购"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">最低起购</label>
        <div class="layui-input-block">
            <input type="text" name="buy_min_number" required lay-verify="required|buy_min_number" placeholder="请输入最低起购"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">库存扣减</label>
        <div class="layui-input-block">
            <input type="checkbox" name="is_deduction_inventory" lay-skin="switch">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上架</label>
        <div class="layui-input-block">
            <input type="checkbox" name="is_shelves" lay-skin="switch">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">首页推荐</label>
        <div class="layui-input-block">
            <input type="checkbox" name="is_home_recommended" lay-skin="switch">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详情页</label>
        <div class="layui-input-block">
            {componets:uedit name="content" content="请输入内容"/}
            <script> layui.extend({tinymce: "tinymce/tinymce"}).use(["tinymce", "util", "okLayer"], function () {
                var tinymce = layui.tinymce,okLayer = layui.okLayer;
                var edit = tinymce.render({
                    elem: "#edit",
                    height: 600,
                    width: "100%",
                    plugins: [
                        'advlist autolink lists link imageSelector hr',
                        'visualblocks visualchars code',
                        'textcolor colorpicker textpattern'
                    ],
                    imageSelectorCallback: showImageSelector,
                     toolbar: 'styleselect | forecolor backcolor | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link imageSelector',
                });
                function showImageSelector () {
                    console.log('自定义图片上传事件')
                    okLayer.open("图片管理", "{:addons_url('store://Photos/upload')}?goods_id=0&page=1&limit=18", "90%", "90%", null, function () {
                        // location.reload();
                    })
                }
            });
            </script>
        </div>
    </div>

</form>
</body>

<script src="/static/lib/layui/lay/lay-config.js"></script>
<script>
    layui.config({
        base: '/static/lib/layui/extend/',
    })
    layui.use(['form', "okLayer", "okUtils"], function () {
        var form = layui.form;
        let okLayer = layui.okLayer;
        let okUtils = layui.okUtils;
        okLoading.close();
    })

</script>
</html>